const { get } = require('request');
const request = require('./request')

const BASE_URL = '/system/user'

function updateUserInfo(param) {
  // 这里用POST方式，参数放body
  return request.put(BASE_URL + '/update/info', { avatarBase64: param.avatarBase64, sex: param.sex, nickName: param.nickName, 
    phoneNumber: param.phoneNumber, email: param.email, emailVerifyCode: param.emailVerifyCode })
}

/**
 * 获取登录用户基本信息
 * @returns 
 */
function getLoginUserInfo(){
  return request.get(BASE_URL + '/setting/info');
}

/**
 * 发送电子邮箱验证码
 * @returns 
 */
function sendEmailVerifyCode(email){
  return request.post(BASE_URL + '/send/email/verify', {email: email});
}

module.exports = {
  updateUserInfo,
  getLoginUserInfo,
  sendEmailVerifyCode
} 